//
//  SearchTableViewCell.m
//  ToYourHeartNews
//
//  Created by XJing on 16/1/28.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥. All rights reserved.
//

#import "SearchTableViewCell.h"
@interface SearchTableViewCell ()<UIWebViewDelegate>
@end
@implementation SearchTableViewCell
- (void)dealloc
{
    [_titleWeb release];
    [_detailWeb release];
    [_pictureWeb release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleWeb = [[UIWebView alloc]init];
        _titleWeb.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleWeb];
        _titleWeb.delegate = self;
        [_titleWeb release];
        
        self.detailWeb = [[UIWebView alloc]init];
        _detailWeb.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_detailWeb];
        [_detailWeb release];
        _detailWeb.delegate = self;
        
        self.pictureWeb = [[UIWebView alloc]init];
        _pictureWeb.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_pictureWeb];
        [_pictureWeb release];
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    _titleWeb.frame = CGRectMake(10, 20, self.contentView.frame.size.width / 4 * 3, (self.contentView.frame.size.height - 20) / 2);
    _titleWeb.scrollView.scrollEnabled = NO;
    _titleWeb.backgroundColor = [UIColor clearColor];
   

    _detailWeb.frame = CGRectMake(10, _titleWeb.frame.origin.y + _titleWeb.frame.size.height + 5, _titleWeb.frame.size.width, self.contentView.frame.size.height - 20 - _titleWeb.frame.size.height - 5);
   _detailWeb.scrollView.scrollEnabled = NO;
    _detailWeb.backgroundColor = [UIColor clearColor];
    

    _pictureWeb.frame = CGRectMake(_titleWeb.frame.origin.x + _titleWeb.frame.size.width + 5, _titleWeb.frame.origin.y, self.contentView.frame.size.width - 20 - _titleWeb.frame.size.width - 5, self.contentView.frame.size.height - 20);
     _pictureWeb.scrollView.scrollEnabled = NO;
    _pictureWeb.backgroundColor = [UIColor clearColor];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
     [_titleWeb stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘16%‘"];
    [_detailWeb stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘5%‘"];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
